<template>
<a-locale-provider :locale="locale">
  <div id="app">
    <a-spin v-show="spinning" :spinning=spinning class="loading" :delay=delay size="large" tip="加载中..." />
    <router-view />
  </div>
</a-locale-provider>
</template>

<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN';
import axios from "axios"; //ajax请求工具
export default {
  name: 'App',
  data() {
    return {
      locale: zhCN,
      spinning: false,
      delay: 500,
    }
  },
  created() {
    // 请求拦截器
    axios.interceptors.request.use(config => {
        this.spinning = true
        return config
      },
      error => { //请求出错时
        this.spinning = false
        return Promise.reject(error)
      })
    //响应拦截器
    axios.interceptors.response.use(response => {
        this.spinning = false
        return response
      },
      error => {
        this.spinning = false
        return Promise.reject(error)
      })
  }
}
</script>

<style lang="less">
ul {
    list-style: none;
    padding-left: 0;
}
p {
    line-height: 24px;
}
#app {
    height: 100%;
    width: 100%;
}

.tableBox {
    padding-top: 20px;
}

.pageBox {
    padding: 24px;
    background: #fff;
    border-radius: 5px;
    min-height: 780px;
}

.but-table {
    margin-top: 40px;
}

.table {
    margin-top: 10px;
}

.input {
    margin-top: 20px;
    margin-bottom: 20px;
    .ant-input {
        width: 300px;
        margin: 0 8px 8px 0;
    }
}

.page {
    max-width: 600px;
    margin: 60px auto auto;
}
//分页
.paging {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    padding-top: 10px;
    .total {
        color: #0000006d;
        font-size: 14px;
    }
}
//加载中
.loading {
    position: absolute;
    z-index: 10;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(240, 240, 240, .8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

}
</style>
